package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {

    /**
     * 添加订单明细
     * @param orderDetailList
     */
    void addOrderDetail(List<OrderDetail> orderDetailList);

    /**
     * 通过订单id获得订单明细列表
     * @param id
     * @return
     */
    @Select("select id, name, image, order_id, dish_id, setmeal_id, dish_flavor, number, amount from order_detail where order_id = #{id}")
    List<OrderDetail> getOrderDetailByOrderId(Long id);

    /**
     * 获取某天销售的菜品/套餐的份数
     * @param map
     * @return
     */
    List<OrderDetail> getDishAndNumber(Map map);
}
